package com.abaaba.project2.bean;

import lombok.Data;

import java.util.Date;

@Data
public class Issue {
    private Integer id;

    private String question;

    private String answer;

    private String addTime;

    private String updateTime;

    private Boolean deleted;

    public Issue() {
    }

    public Issue(Integer id, String question, String answer, String addTime, String updateTime, Boolean deleted) {
        this.id = id;
        this.question = question;
        this.answer = answer;
        this.addTime = addTime;
        this.updateTime = updateTime;
        this.deleted = deleted;
    }

    public void setAddTime(String addTime) {
        if (addTime.lastIndexOf(".") != -1) {
            this.addTime = addTime.substring(0, addTime.lastIndexOf("."));
        } else {
            this.addTime = addTime;
        }
    }

    public void setUpdateTime(String updateTime) {
        if (updateTime.lastIndexOf(".") != -1) {
            this.updateTime = updateTime.substring(0, updateTime.lastIndexOf("."));
        }else {
            this.updateTime = updateTime;
        }
    }
}